package org.zezs.deployment.config;

import org.zezs.deployment.Deploy;

public class SpringBootNode extends Node {

    private String jvm = "";

    public String getJvm() {
        return jvm;
    }

    public void setJvm(String jvm) {
        this.jvm = jvm;
    }

    @Override
    public String getFilePath() {
        return this.getHomePath() + "/" + this.getName();
    }

    @Override
    public String getShellId() {
        return Deploy.exeCmd("ps -ef |grep '"+this.getName()+"' |grep -v 'grep'|awk '{print $2}'",this.getSession());
    }

    @Override
    public void clear() {
        Deploy.exeCmd("rm -rf " + getFilePath(),this.getSession());
    }

    @Override
    public void star() {
        Deploy.exeCmd("source /etc/profile;cd "+getHomePath()+";nohup java "+getJvm()+" -jar "+getName()+" "+getParam()+"  >>"+getName()+".log &",this.getSession());
    }

}
